<template>
  <div>
    <emp-header></emp-header>
    <emp-list :emplist="emplist"></emp-list>
  </div>
</template>

<script>
  import axios from 'axios'

  import EmpList from './components/list'
  import EmpHeader from './components/mainHeader'

  export default {
    name: "emp",
    components: {
      EmpList,
      EmpHeader,
    },
    data() {
      return {
        emplist: []
      }
    },
    mounted() {
      axios.get('/api/emplist/index/token/' + localStorage.getItem('token'))
        .then((res) => {
          console.log(res)
          if (res.data.code <= 0) {
            alert(res.data.msg)
            this.$router.push('/login')
          }

          this.emplist = res.data.data.data;
        })
        .catch((err) => {
          console.log(err);
        });
    }
  }
</script>

<style scoped>

</style>
